package com.gdk.ksoft.ui.works.models;

import android.os.Parcel;
import android.os.Parcelable;

import com.gdk.ksoft.data.entry.tables.GoodsModuleTable;
import com.gdk.ksoft.data.entry.tables.GoodsTable;

/**
 * Created by hel on 2014-11-28.
 * 商品订单数据实体模型
 */
public class FworkGoodsOrderModel implements Parcelable{

    /**
     * 商品购物车ID
     */
    public int shoppingCartGoodsId;

    /**
     * 商品信息
     */
    public GoodsTable goodsInfo;

    /**
     * 商品计量单位信息
     */
    public GoodsModuleTable goodsModuleInfo;

    /**
     * 客户网络ID
     */
    public int kh_id;

    /**
     * 客户送货地址网络ID
     */
    public int shdz_id;

    /**
     * 件价
     */
    public float piecePrice = 0f;

    /**
     *  商品所属类型
     * "正常","赠送"
     * "补货","换货"
     * "兑奖","陈列"
     */
    public int goodsType = 0;

    /**
     * 商品件数
     */
    public int pieceNum = 0;

    /**
     * 商品单数
     */
    public int singleNum = 0;

    /**
     * 总金额
     */
    public float totalMoney;

    /**
     * 备注信息
     */
    public String noteInfomation;

    /**
     * 最终价格
     */
    public float finalPrice;

    /**
     * 是否能修改商品价格，默认能
     */
    public int isCanChangePrice = 1;

    /**
     * 商品生产日期
     */
    public String goodsProductDate;

    /**
     * 商品保质期
     */
    public int goodsBzq;

    /**
     * 促销标识
     */
    public String cx_bz;

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeValue(goodsInfo);
        dest.writeValue(goodsModuleInfo);
        dest.writeFloat(piecePrice);
        dest.writeInt(goodsType);
        dest.writeInt(pieceNum);
        dest.writeInt(singleNum);
        dest.writeFloat(totalMoney);
        dest.writeString(noteInfomation);
        dest.writeFloat(finalPrice);
        dest.writeInt(isCanChangePrice);
        dest.writeString(goodsProductDate);
        dest.writeInt(goodsBzq);
        dest.writeString(cx_bz);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<FworkGoodsOrderModel> CREATEOR = new Creator<FworkGoodsOrderModel>() {
        @Override
        public FworkGoodsOrderModel createFromParcel(Parcel source) {
            FworkGoodsOrderModel model = new FworkGoodsOrderModel();
            model.goodsInfo = (GoodsTable)source.readValue(GoodsTable.class.getClassLoader());
            model.goodsModuleInfo = (GoodsModuleTable)source.readValue(GoodsModuleTable.class.getClassLoader());
            model.piecePrice = source.readFloat();
            model.pieceNum = source.readInt();
            model.singleNum = source.readInt();
            model.totalMoney = source.readFloat();
            model.noteInfomation = source.readString();
            model.finalPrice = source.readFloat();
            model.isCanChangePrice = source.readInt();
            model.goodsProductDate = source.readString();
            model.goodsBzq = source.readInt();
            model.cx_bz = source.readString();
            return model;
        }

        @Override
        public FworkGoodsOrderModel[] newArray(int size) {
            return new FworkGoodsOrderModel[size];
        }
    };
}
